import type { App } from 'vue'
import { createPinia } from 'pinia'
import persist from 'pinia-plugin-persistedstate'
import useLoginStore from './login/login'

const pinia = createPinia()
pinia.use(persist) // 数据持久化

function registerStore(app: App) {
  app.use(pinia)

  // 刷新页面时重新注册路由
  const loginStore = useLoginStore()
  loginStore.loadLocalCacheAction()
}

export default registerStore
